var express = require("express");
var app = express();
var url = require("url");

app.use(express.static('www'));

app.get("/foodbever/wechat/authorize", function (req, res) {
    var query = url.parse(req.url , true).query;
    console.log(query);
    
    res.json({
        "status": 0,
        "msg": "成功",
        "data": {
            "storeId": 1,
            "storeName": "福海烧烤店",
            "storeIcon": "http://localhost:8080/img/1.img",
            "tableId": 8,
            "tableType": "21",
            "userOpenid": "11111111",
            "userName": "ajunge",
        }
    });
})
app.get("/foodbever/buyer/product/:a", function (req, res) {
    res.json({
        "status": 0,
        "msg": "成功",
        "data": [{
            "name": "热榜",
            "type": 1,
            "foods": [
                {
                    "id": "123456",
                    "name": "皮蛋粥",
                    "price": 1.20,
                    "description": "好吃的皮蛋粥",
                    "icon": "http://xxx.com",
                    "stockstatus": 0,
                }
            ]
        },
        {
            "name": "好吃的",
            "type": 2,
            "foods": [
                {
                    "id": "123457",
                    "name": "慕斯蛋糕",
                    "price": 10.90,
                    "description": "美味爽口",
                    "icon": "http://xxx.com",
                    "stockstatus": 0, //表示立即下单，如果是1就是加单
                }
            ]
        }
        ]
    }

    )
})
app.get("/foodbever/buyer/order/:a", function (req, res) {
    res.json({
        "status": 0,
        "msg": "成功",
        "data": {
            "orderId": "11111111",
            "storeName": "福海烧烤店",
            "tableType": "1",
            "userName": "sssss",
            "createTime": "2000-19-9",
            "buyerOrderProductVOS": [{
                "productName": "白酒",
                "productPrice": 11,
                "productQuantity": 12
            },
            {
                "productName": "白酒",
                "productPrice": 11,
                "productQuantity": 12
            },
            {
                "productName": "白酒",
                "productPrice": 11,
                "productQuantity": 12
            }]
        }
    }
    )
})
app.get("/foodbever/seller/tables_order/:a", function (req, res) {
    res.json({
        "status": 0,
        "msg": "成功",
        "data": {
            "tablesType": 1,
            "buyerOrderProductVOS": [{
                "orderId": "2222",
                "userName": "ssssss",
                "orderAmount": 22,
                "createTime": "2000-10-2",
                "productList": [{
                    "productId": "sssss",
                    "productName": "ssssss",
                    "productPrice": 23,
                    "productQuantity": 22
                }]
            }]
        }

    }
    )
})
app.post("/foodbever/buyer/order/create", function (req, res) {
    res.json({
        "status": 0,
        "msg": "成功",
        "data": {
            "orderId": "11111111",
        }

    }
    )
})
app.listen(3000);